{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# H- with GVB\n",
    "\n",
    "GVB works for H2, including proper dissociation and doesn't work for H-. Works for He, ie it gives a lower energy with GVB than with HF."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "%matplotlib inline\n",
    "from pyquante2.scf.mcscf import gvb\n",
    "from pyquante2.geo.samples import he\n",
    "from pyquante2.geo.molecule import molecule\n",
    "from pyquante2.basis.basisset import basisset\n",
    "from pyquante2.orbman import orbman\n",
    "import matplotlib.pyplot as plt"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "**** PyQuante GVB ****\n",
      "Stoichiometry = He, Charge = 0, Multiplicity = 1\n",
      "2 He     0.000000     0.000000     0.000000\n",
      "Nuclear repulsion energy: 0.000\n",
      "Basis set: 6-31g\n",
      "  ncore/open/pair: 1,0,0\n",
      "  occ/bf/orb: 1,2,2\n",
      "Shell 0\n",
      "  occupation = 1.00\n",
      "  orbitals in shell [0]\n",
      "  couplings to other shells [(2.0, -1.0)]\n",
      "Starting guess at orbitals:\n",
      "[[-0.7725  1.0372]\n",
      " [-0.3121 -1.2551]]\n",
      "Shell array: [0]\n",
      "****\n",
      "ROTION Delta Matrix\n",
      "[[ 0.]]\n",
      "---- 1 :     -2.7419     0.0000    -1.9936     1.2453\n",
      "ROTION Delta Matrix\n",
      "[[ 0.]]\n",
      "---- 2 :     -2.8544     0.0000    -1.9491     1.0438\n",
      "ROTION Delta Matrix\n",
      "[[ 0.]]\n",
      "---- 3 :     -2.8552     0.0000    -1.9417     1.0282\n",
      "ROTION Delta Matrix\n",
      "[[ 0.]]\n",
      "---- 4 :     -2.8552     0.0000    -1.9411     1.0270\n",
      "Energy converged\n",
      "HF energy:  -2.85516038226\n",
      "**** PyQuante GVB ****\n",
      "Stoichiometry = He, Charge = 0, Multiplicity = 1\n",
      "2 He     0.000000     0.000000     0.000000\n",
      "Nuclear repulsion energy: 0.000\n",
      "Basis set: 6-31g\n",
      "  ncore/open/pair: 0,0,1\n",
      "  occ/bf/orb: 2,2,2\n",
      "Shell 0\n",
      "  occupation = 1.00\n",
      "  orbitals in shell [0]\n",
      "  couplings to other shells [(1.0, 0.0), (0.0, -0.0)]\n",
      "Shell 1\n",
      "  occupation = 0.00\n",
      "  orbitals in shell [1]\n",
      "  couplings to other shells [(0.0, -0.0), (0.0, 0.0)]\n",
      "Starting guess at orbitals:\n",
      "[[-0.5921  1.1498]\n",
      " [-0.5136 -1.187 ]]\n",
      "Shell array: [0, 1]\n",
      "****\n",
      "ROTION Delta Matrix\n",
      "[[  0.0000e+00  -5.7696e-06]\n",
      " [  5.7696e-06   0.0000e+00]]\n",
      "GVB CI Matrix for pair 0\n",
      "[[-2.8552  0.2277]\n",
      " [ 0.2277  0.5889]]\n",
      "GVB CI Eigenvector for pair 0\n",
      "[[-0.9978 -0.0657]\n",
      " [ 0.0657 -0.9978]]\n",
      "GVB CI Eigenvalues for pair 0\n",
      "[-2.8701  0.6039]\n",
      "---- 1 :     -2.8552     0.0000    -1.9410     1.0269\n",
      "ROTION Delta Matrix\n",
      "[[ 0.    -0.002]\n",
      " [ 0.002  0.   ]]\n",
      "GVB CI Matrix for pair 0\n",
      "[[-2.8539  0.2289]\n",
      " [ 0.2289  0.5874]]\n",
      "GVB CI Eigenvector for pair 0\n",
      "[[-0.9978 -0.0661]\n",
      " [ 0.0661 -0.9978]]\n",
      "GVB CI Eigenvalues for pair 0\n",
      "[-2.8691  0.6026]\n",
      "---- 2 :     -2.8701     0.0000    -1.9330     0.9959\n",
      "ROTION Delta Matrix\n",
      "[[  0.0000e+00  -1.2199e-05]\n",
      " [  1.2199e-05   0.0000e+00]]\n",
      "GVB CI Matrix for pair 0\n",
      "[[-2.8551  0.2279]\n",
      " [ 0.2279  0.5884]]\n",
      "GVB CI Eigenvector for pair 0\n",
      "[[-0.9978 -0.0658]\n",
      " [ 0.0658 -0.9978]]\n",
      "GVB CI Eigenvalues for pair 0\n",
      "[-2.8702  0.6034]\n",
      "---- 3 :     -2.8702     0.0000    -1.9317     0.9933\n",
      "Energy converged\n",
      "GVB energy:  -2.87016174345\n"
     ]
    }
   ],
   "source": [
    "E,orbs = gvb(he,maxiter=10,basisname='6-31g',npair=0,verbose=True,\n",
    "             return_orbs=True)\n",
    "print \"HF energy: \", E\n",
    "E,orbs = gvb(he,maxiter=10,basisname='6-31g',npair=1,verbose=True,\n",
    "             return_orbs=True,input_orbs=orbs)\n",
    "print \"GVB energy: \", E"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 2",
   "language": "python",
   "name": "python2"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 2
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython2",
   "version": "2.7.13"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
